import { queryOnlineRateTrend } from "@/apis/charts";
import { useRequest } from "ahooks";
import type { OnlineRateResponseType } from "@/types/echartInterface";
const useGetOnlineRateData = (times: string) => {
  const {
    data = {},
    loading,
    refresh,
  } = useRequest(
    async () => {
      const data: OnlineRateResponseType = await queryOnlineRateTrend({
        times,
      });
      return data;
    },
    {
      refreshDeps: [times], //刷新依赖项
    }
  );

  return { data, loading, refresh };
};
export default useGetOnlineRateData;
